<template>
  <div class="bask_single">
    <div class="comment" v-if="allList.length">
      <div class="comment_tit">
        <p class="title f28">用户晒单</p>
      </div>
      <free-watch v-for="(item,index) in allList" :key="index" :item="item" ></free-watch>
	  <!-- <estimate v-for="(item, key) in allList" :key="key" :item="item"></estimate> -->
	  <div class="more" ref="more" @click="getMore()">加载更多</div>
    </div>
  </div>
</template>

<script>
import estimate from "@/components/estimate";
import freeWatch from "@/components/freeWatch";
export default {
  name: "baskSingle",
  components: {
    estimate,
    freeWatch
  },
  data() {
    return {
      offset: 0,
      limit: 5,
      allList: []
    };
  },
  created() {
    this.getFqCatConsultance();
  },
  methods: {
    getAllFeedback() {
      let params = {
        feedbackType: 1,
        offset: this.offset,
        limit: this.limit
      };
      this.$http.fetchGet("getAllFeedback", params).then(res => {
      // this.allList = res.data;
      if(this.offset == 0) this.allList = res.data;
      else this.allList.push(...res.data);
      if(res.data.length == 0) {
        this.offset -= this.limit;
        this.$refs.more.style.display = 'none'
      }
    });
  },
  getFqCatConsultance() {
    let params = {
      cat_id: 0,
      limit: this.limit
    }
    this.$http.fetchGet('getFqCatConsultance', params).then(res => {
      if(this.offset == 0) this.allList = res.data;
      else this.allList.push(...res.data);
      if(res.data.length == 0) {
        this.offset -= this.limit;
        this.$refs.more.style.display = 'none'
      }
    })
  },
	getMore() {
		this.offset += this.limit
		this.getFqCatConsultance()
	}
  }
};
</script>

<style lang="less" scoped>
.bask_single {
  .comment {
    .comment_tit {
	  .padd(30, 0);
	  .pl(20);
      .title {
		.h(32);
		.lh(32);
		.pl(10);
		border-left: 2px solid #189BEB;
        position: relative;
      }
	}
	.more{
		.lh(100);
		text-align: center;
		.mb(40);
		color: #189BEB;
	}
  }
}
</style>
